<template>
  <div class="defaultLogin">
    <div class="login" v-if="!needMenberShow">
      <!-- start 主界面信息 -->
      <div class="inner">
        <div class="logo">
          <div class="icon_wapper">
            <div class="icon" width="94" height="73"></div>
          </div>
          <p>{{systemInfo.loginPageName}}</p>
        </div>
        <form class="form">
          <div class="ct">
            <h3 class="title">
              <span>{{systemInfo.loginPageName}}登录</span>
            </h3>
            <!-- 用户 账号 -->
            <div class="ip-box acount" :class="{
              act: acountAct
            }">
              <span class="ip-icon">
                <pt-icon name="user"></pt-icon>
              </span>
              <div class="ip-sr">
                <input
                  type="text"
                  ref="userName"
                  placeholder="请输入账号"
                  autocomplete
                  autofocus="autofocus"
                  v-model="loginForm.username"
                  @focus="acountAct = true"
                  @blur="acountAct = false"
                  @keyup.enter="loginIn"
                />
              </div>
            </div>
            <!-- 用户 密码 -->
            <div class="ip-box password" :class="{
              act: passwordAct
            }">
              <span class="ip-icon">
                <pt-icon name="password"></pt-icon>
              </span>
              <div class="ip-sr">
                <input
                  type="password"
                  placeholder="请输入密码"
                  autocomplete
                  v-model="loginForm.password"
                  @focus="passwordAct = true"
                  @blur="passwordAct = false"
                  @keyup.enter="loginIn"
                />
              </div>
            </div>
            <div class="submit">
              <el-button type="primary" class="login_btn" @click="loginIn">登 录</el-button>
            </div>
            <div class="bottom">
              <pt-checkbox
                @input="handleRemenber"
                borderRadius="50%"
                v-model="rememberInfo"
              >记住我（公共场所慎用）</pt-checkbox>
              <pt-button @click="handleReset" type="text" style="font-size: 12px; float: right;">重置</pt-button>
            </div>
          </div>
        </form>
      </div>
      <!-- end 主界面信息 -->

      <!-- start 底部公司信息 -->
      <div class="com_bottom">Copypoght © 1998-2019 广州市合道信息科技有限公司 All Rights Reserved</div>
      <!-- end 底部公司信息 -->
    </div>
    <div class="defaultLoginWrapper" v-else>
      <div class="wrapper">
        <div class="defaultLoginWrapper-header">{{systemInfo.loginPageName}}</div>
        <choseMenber ref="choseMenber" @click="handClickFun"></choseMenber>
      </div>
    </div>
  </div>
</template>

<script>
import login from "../mixins/login"; // 登陆的公用方法
import choseMenber from "../tgLogin/components/choseMenber";
import { postDefaultSystem } from "@/api/desktop/index.js";
import { mapGetters } from "vuex";
export default {
  name: "defaultLogin",
  mixins: [login],
  data () {
    return {
    };
  },
  components: {
    choseMenber
  },
  computed: {
    ...mapGetters(["needMenberShow", "systemCode", "currentUser", "systemInfo"])
  },
  methods: {
    handClickFun (item) {
      console.log(item);
      let params = {
        name: item.name,
        value: item.menuId
      };
      let code = this.systemCode === 1 ? "portal" : "chiefportal";
      console.log(this.currentUser);
      postDefaultSystem(params, this.token).then(res => {
        if (res.data.code === 0) {
          this.goToHome(this.currentUser, code);
        }
      });

    }
  }
};
</script>

<style lang="less" scoped>
.defaultLogin{
  width:100%;
  height:100%;
  background-image: url("./images/tgBg.jpg");
  background-repeat: no-repeat;
  background-position: center center;
  // display:flex;
  // align-items: center;
  // justify-content: center;
}
.defaultLoginWrapper{
  // width: 1200px;
  width: 100%;
  height: 100%;
  display:flex;
  align-items: center;
  justify-content: center;
  .wrapper{
    width: 1200px;
    .defaultLoginWrapper-header{
      width: 100%;
      height: 80px;
      display:flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      font-weight:bold;
      // .color()
      color: #fff;
      font-size: 30px;
      margin-bottom: 30px;
    }
  }
}
.login {
  position: relative;
  height: 100%;
  background-image: url("@{baseUrl}/img/login-bg-2.png");
  background-size: 100% 100%;
  background-position: center center;
  overflow-x: hidden;
  overflow-y: auto;

  // 主界面信息
  .inner {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1000px;
    height: 500px;
    background-color: @bgColor3;
    margin-left: -500px;
    margin-top: -250px;
    border-radius: 10px;
    box-shadow: 0px 0px 7px 0px rgba(23, 40, 60, 0.2);
    .logo {
      float: left;
      width: 360px;
      height: 500px;
      padding-top: 188px;
      box-shadow: 2px 0px 6px 0px #ddd;
      background-image: url("@{baseUrl}/img/login-logo-bg-2.png");
      .icon_wapper {
        text-align: center;
        padding-bottom: 24px;
        .icon {
          display: inline-block;
          width: 94px;
          height: 73px;
          background-image: url("@{baseUrl}/img/logo-2.png");
        }
      }
      p {
        color: @theme2-primary;
        font-size: 26px;
        text-align: center;
      }
    }
    .form {
      padding-top: 96px;
      padding-left: 360px;
      .ct {
        padding: 0 124px;
      }
      .title {
        margin-bottom: 42px;
        text-align: center;
        font-weight: 300;
        span {
          position: relative;
          display: inline-block;
          padding: 0 10px;
          color: @fColor1;
          font-size: 26px;
          line-height: 26px;
          vertical-align: top;
          &::before,
          &::after {
            content: "";
            position: absolute;
            top: 10px;
            border-radius: 5px;
            height: 5px;
            width: 5px;
            background-color: #303133;
          }
          &::before {
            left: -3px;
          }
          &::after {
            right: -3px;
          }
        }
      }
      .acount {
        margin-bottom: 20px;
      }
      .password {
        margin-bottom: 40px;
      }
      .ip-box {
        padding: 8px 0;
        border-bottom: 1px solid @fColor5;
        .ip-icon {
          float: left;
          width: 50px;
          height: 30px;
          line-height: 30px;
          text-align: center;
          .pt-icon {
            font-size: 24px;
            color: @fColor1;
          }
        }
        .ip-sr {
          padding-left: 50px;
          input {
            width: 100%;
          }
        }
        input {
          color: @fColor1;
          height: 30px;
          line-height: 30px;
          border: none;
          border-left: 1px solid @fColor5;
          padding-left: 16px;
          font-size: 16px;
        }
        &.act {
          border-bottom-color: @theme2-primary;
          .pt-icon {
            color: @theme2-primary;
          }
          input {
            color: @fColor1;
          }
        }
      }
      .submit /deep/ {
        margin-bottom: 14px;
        .login_btn {
          border: none;
          border-radius: 5px;
          width: 100%;
          height: 50px;
          color: white;
          font-size: 18px;
          background-color: @theme2-primary !important;
          &:hover {
            opacity: 0.9;
          }
        }
        .pt-button {
          height: 50px;
        }
      }
      .bottom {
        user-select: none;
        /deep/ .pt-checkbox {
          .btn {
            border-width: 2px;
            border-color: @theme2-primary;
          }
          &.checked .btn {
            background-color: @theme2-primary;
          }
        }
      }
    }
  }

  // 底部公司信息
  .com_bottom {
    position: absolute;
    left: 50%;
    top: 50%;
    margin-top: 260px;
    margin-left: -250px;
    color: #303133;
    font-size: 14px;
    // transform: translate(-50%, 260px);
  }
}
</style>
